<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/admin/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.css" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
</head>

<body>
<div class="hidden">
    {{$gqjID = DB::table('setting')->where('id', '1')->value('enable_tool_ID')}}
</div>
<article class="page-container">
    <a class="btn btn-primary radius size-MINI" href="/{{config('constant.name_admin')}}/viewRes/exportReport/export?id={{ $gaiyao_data->contract_id }}&toPdf=1" target="_blank">查看相关检测报告</a>
    <div class="mb-15">
        <div class="f-l" style="width:50%">
            <b>送检单位：</b>{{ $gaiyao_data->client_name }}<br>
            <b>样品名称：</b>{{ $gaiyao_data->tool_name }}<br>
            <b>条 形 码：</b><span style="color:red;font-size:18px;">{{ $sample_info_data->bar_code }}</span><br>
            @if($gqjID)
                <b>工器具ID：</b><span style="color:red;">{{ $sample_info_data->gqj_ID }}</span><br>
            @endif
            <b>检验标准：</b>{{ $gaiyao_data->std_num }}<br>
            <b>额定电压：</b>{{ $gaiyao_data->voltage }}<br>
            <b>分　　类：</b>{{ $gaiyao_data->class }}<br>
            <b>样品状态：</b>{{ $sample_info_data->sample_status }}<br>
        </div>
        <div class="f-l" style="width:50%">
            <b>自 编 号:</b>{{ $sample_info_data->self_num }}<br>
            <b>生产厂家：</b>{{ $sample_info_data->manufacturer }}<br>
            <b>生产日期：</b>{{ $sample_info_data->production_date }}<br>
            <b>规格型号：</b>{{ $sample_info_data->guige_xinghao }}<br>
            <b>商　　标：</b>{{ $sample_info_data->brand }}<br>
            <b>检验周期：</b>{{ $cycle }}年<br>
            <b>试验日期：</b>{{ $sample_info_data->test_time }}<br>
            <b>@if(config('constant.app_name') == 'SiChuanTongZhou') 下次试验日期： @else 有效期至： @endif</b>{{ $sample_info_data->next_time }}<br>
        </div>
        <div style="clear:both"></div>
    </div>
    {{-- <div class="cl pd-5 bg-1 bk-gray mt-10 mb-10">
        <span class="l">
            <b>条形码：</b><input type="text" class="input-text" value="" placeholder="后三位" id="bar-code" style="width:60px">
        </span>
        <span class="l ml-10">
            <a class="btn btn-primary radius" href="javascript:;" onclick="goto_jump()">跳转</a>
        </span>
        <span class="r mr-10">
            @if ($sample_id_next)
                <a class="btn btn-primary radius" href="javascript:;" onclick="goto_pre_next({{ $sample_id_next }})">下一个</a>
            @else
                <a class="btn radius disabled" href="javascript:;">下一个</a>
            @endif
        </span>
        <span class="r mr-20">
            @if ($sample_id_pre)
                <a class="btn btn-primary radius" href="javascript:;" onclick="goto_pre_next({{ $sample_id_pre }})">上一个</a>
            @else
                <a class="btn radius disabled" href="javascript:;">上一个</a>
            @endif
        </span>
    </div> --}}

    <ul id="Huifold" class="Huifold">
        @foreach ($items_data as $val){{-- 第一层循环 --}}
        {{-- <form action="" method="post"> --}}
        <li class="item mt-5">
            <h4>
                {{ $val->name }}
                @if ($val->res === 1)
                    <span class="badge badge-success radius">符合</span>
                @elseif ($val->res === 0)
                    <span class="badge badge-danger radius">不符合</span>
                @endif
                {{-- <b>+</b> --}}
            </h4>
            @if($val->res === 0)
                <b>　　　　</b><b>备注：</b><span class="down-line">{{ $val->remark }}</span>
            @endif
            {{-- <div class="info"> --}}
            {{-- <b style="color:blue">主检人员</b>&emsp;
            {{ $val->realname }} --}}
            {{-- <hr style='margin:5px;background-color:#ddd;height:1px;width:100%;border:none;'>
            <b style="color:blue">检验标准</b>&emsp;
            @php
                $yaoqiu = DB::table('a_std_tool_item_rel')->where([
                    ['std_id','=',$gaiyao_data->std_id],
                    ['tool_id','=',$gaiyao_data->tool_id],
                    ['testitem_id','=',$val->item_id]
                ])->value('jishu_yaoqiu');

                $key_condition = DB::table('a_condition_key')->select('id','key','unit')->where([
                    ['std_id','=',$gaiyao_data->std_id],
                    ['tool_id','=',$gaiyao_data->tool_id],
                    ['item_id','=',$val->item_id]
                ])->orderBy('sort')->get();

                foreach ($key_condition as $k => $v){ // 第二层循环
                    $val_condition = DB::table('a_condition')->where('condition_key_id','=',$v->id)->whereIn('vol_class_id',[$gaiyao_data->vol_id,$gaiyao_data->class_id])->value('val');
                    echo "<b>{$v->key}：</b>$val_condition{$v->unit}&emsp;";
                }

                echo "<b>要求：</b>$yaoqiu";
                echo "<hr style='margin:5px;background-color:#ddd;height:1px;width:100%;border:none;'>";
            @endphp --}}

            <input type="hidden" name="item_id" value="{{ $val->id }}">
            {{-- <b style="color:blue">原始记录</b>&emsp;
            <b>天气：</b>{{$val->wea}}&emsp;
            <b>大气压力：</b>{{$val->pressure}}kPa&emsp;
            <b>环境温度：</b>{{$val->temp}}℃&emsp;
            <b>相对湿度：</b>{{$val->hum}}%&emsp;

            @php
                $key_data = DB::table('a_testdata_key')->select('id','data_key','data_unit')->where([
                    ['std_id','=',$gaiyao_data->std_id],
                    ['tool_id','=',$gaiyao_data->tool_id],
                    ['item_id','=',$val->item_id]
                ])->orderBy('sort')->get();

                foreach ($key_data as $k => $v) {
                    $input_data = DB::table('a_input_data')->where([
                        ['sample_info_id','=',$sample_info_data->id],
                        ['testdata_key_id','=',$v->id]
                    ])->first();
                    if ($input_data) {
                        echo "<span><b>{$v->data_key}：</b>{$input_data->val}{$v->data_unit}&emsp;</span>";
                    }
                }
            @endphp --}}
            {{-- </div> --}}
        </li>
        {{-- </form> --}}
        @endforeach
        @if($history)
            <li class="item mt-10">
                <h4>当前工器具共有 <span id="hisnum"></span> 条历史检测信息 <b>+</b></h4>
                <div class="info" id="hisinfo"></div>
            </li>
        @endif
    </ul>

</article>
<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/admin/lib/layer/3.1.1/layer.js"></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<script>


    $(function(){
        hismore();

        $("#Huifold").Huifold({
            titCell:'.item h4',
            mainCell:'.item .info',
            type:3,
            trigger:'click',
            className:"selected",
            // speed:"fast",//"slow" | "normal" | "fast"
            speed:0
        });

        //默认展开第一个
        // $("#Huifold li").first().find('h4').trigger("click");
        // $("#Huifold li").find('h4').trigger("click");

    });

    /*查看上一个 下一个样品*/
    function goto_pre_next(id){
        window.location.href="/{{config('constant.name_admin')}}/itemData/view?id=" + id;
    }
    function hismore(){
        let historys = @json($history),hislen = historys.length;
        $('#hisnum').text(hislen);
        let str = '';
        for(let i=0;i<hislen;i++){
            str += '<a class="btn  btn-primary radius mt-10 btn-block size-XL" href="?id='+historys[i]['id']+'&k='+historys[i]['key']+'"> 点击查看'+historys[i]['test_time']+'的检测结果</a>';
        }
        $('#hisinfo').html(str);
    }
</script>

</body>

</html>
